//
//  GRRiceStatusCell.m
//  YC_GRice
//
//  Created by luojinrong11 on 2018/9/7.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRRiceStatusCell.h"

@implementation GRRiceStatusCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)updateWithModel:(id)model atIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view{
    self.riceModel = model;

    if ([_riceModel.state isEqualToString:@"pay"]) {
        self.titleLabel.text =@"请尽快支付";
        self.contentLabel.text = @"30分钟后未支付，订单会自动取消";
    }else if([_riceModel.state isEqualToString:@"cancel"]){
        self.titleLabel.text = _riceModel.isTimeOut?@"订单超时未支付":@"你已取消了订单";
        self.contentLabel.text =  _riceModel.isTimeOut?@"超过30分钟未支付，订单已自动取消":@"欢迎再次使用哦~更多优惠套餐等着你哦~";
        
    }
   
    
    
    
}

- (IBAction)cancelOrder:(id)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(detailOrderWithOrderType: orderModel:)]) {
        [_delegate detailOrderWithOrderType:RiceOrderActionTypeCancleOrder orderModel:self.riceModel];
    }
}


- (IBAction)payAction:(id)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(detailOrderWithOrderType: orderModel:)]) {
        [_delegate detailOrderWithOrderType:RiceOrderActionTypePayOrder orderModel:self.riceModel];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
